package cn.zswltech.gruul.api;

import cn.zswltech.gruul.common.dal.query.UserQuery;
import cn.zswltech.gruul.common.dal.vo.GruulDictionaryDTO;
import cn.zswltech.gruul.common.dal.vo.UserVO;
import cn.zswltech.gruul.common.param.UserParam;
import cn.zswltech.gruul.common.result.Response;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @author Jim
 * @version 1.0.0
 * @descripition:
 * @date 2024/1/29 13:30
 */
// @FeignClient(value = "gruul",path = "/user")
@RequestMapping("user")
public interface UserApi {

    /**
     * 查询用户列表,带分页
     *
     * @param query
     * @return
     * @
     */
    @GetMapping("list")
    Response<Map<String, Object>> queryUser(UserQuery query);

    /**
     * 查询所有账号和用户中文名的映射关系，前端替换、下拉框等地方使用
     * @return map key=account, value=username
     */
    @GetMapping("accountUsernameMappingList")
    Response<List<GruulDictionaryDTO>> accountUsernameMappingList(@RequestParam(required = false) String orgCode);

    /**
     * 查询用户信息
     *
     * @return
     * @
     */
    @GetMapping
    Response<UserVO> queryUser();

    /**
     * 创建用户
     *
     * @param userParam
     * @return
     * @
     */
    @PostMapping
    Response createUser(@RequestBody UserParam userParam);

    /**
     * 更新用户
     *
     * @param userParam
     * @return
     * @
     */
    @PutMapping
    Response updateUser(@RequestBody UserParam userParam);

    /**
     * 删除用户
     *
     * @param id
     * @return
     * @
     */
    @DeleteMapping
    Response deleteUser(@RequestParam("id") Long id);

    /**
     * 重置密码
     *
     * @param id
     * @return
     * @
     */
    @PutMapping("resetPwd")
    Response resetPwd(@RequestParam("id") Long id, HttpServletResponse httpServletResponse);

    /**
     * 启动/禁用用户
     *
     * @param id
     * @return
     * @
     */
    @PutMapping("status")
    Response status(@RequestParam("id") Long id, @RequestParam("status") int status);
}
